#include <iostream>
#include <algorithm>
#include <string>
#include <cctype>
#include <cmath>
using namespace std;
const int N = 2010;
int a[N]; 
bool isprime(int n)
{
	if(n<=1)
	return false;
	for(int i = 2;i<=sqrt(n);i++)
	{
		if(n%i == 0)
		return false;
	}
	return true;
}
int main()
{
    int n;
    cin >> n;
    long long sum = 0;
    for(long long i = 2;i<=n;i++)
    {
    	if(isprime(i))
    	sum+=i;
	}
	cout << sum<< endl;
   
	return 0;
}
